package com.dongdongshop.consumer;

import com.alibaba.dubbo.config.annotation.Reference;
import com.dongdongshop.service.FreemarkerService;
import org.apache.rocketmq.spring.annotation.MessageModel;
import org.apache.rocketmq.spring.annotation.RocketMQMessageListener;
import org.apache.rocketmq.spring.core.RocketMQListener;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @Description
 * @ClassName ItemPageConsumer
 * @Author RC
 * @date 2020.12.18 11:52
 */
@Component
@RocketMQMessageListener(topic = "approvedSendSuccess",messageModel = MessageModel.BROADCASTING,consumerGroup = "dongdongshop_producer")
public class ItemPageConsumer implements RocketMQListener<Long[]> {

    @Autowired
    private FreemarkerService freemarkerService;
    private static final Logger logger = LoggerFactory.getLogger(ItemPageConsumer.class);

    @Override
    public void onMessage(Long[] longs) {
        for (int i = 0; i < longs.length; i++) {
            freemarkerService.createItemPage(longs[i]);
        }
    }
}
